import bundleAnalyzer from '@next/bundle-analyzer';

const isProd = process.env.NODE_ENV === 'production';

const withBundleAnalyzer = bundleAnalyzer({
    enabled: process.env.ANALYZE === 'true',
    openAnalyzer: true,
    analyzerMode: 'static'
});

/** @type {import('next').NextConfig} */
const nextConfig = {
    assetPrefix: isProd ? '/tk' : '/tk',
    compress: isProd ? true : undefined,
    generateEtags: true,
    cacheHandler: process.cwd() + '/cache-handler.js',
    cacheMaxMemorySize: 60 * 1024,
    typescript: {
        ignoreBuildErrors: true
    },
    eslint: {
        ignoreDuringBuilds: true
    },
    webpack: config => {
        return config;
    }
};

export default withBundleAnalyzer(nextConfig);
